#ifndef _EVENTLOOP_H_
#define _EVENTLOOP_H_

#include <functional>
#include <vector>
#include <chrono>

namespace Engine2D
{
    struct Status
    {
        enum Type
        {
            Start,
            Stop,
        };
        Type CurrentStatus() { return status; }
        void ConvertStatus(Type type) { status = type; }
        Type status = Start;
    };

    class EventLoop : public Status
    {
    public:
        EventLoop() = default;
        virtual ~EventLoop() = default;

        void Start(std::function<void(EventLoop *)> fn, int fps = 60);

        template<typename F>
        void PushEvent(F && fn) { m_eventQueue.push_back(std::forward<F>(fn)); }

    private:
        std::vector<std::function<void(void)>> m_eventQueue;
        std::chrono::steady_clock::time_point m_oldTime;
    };
} // namespace Engine2D



#endif